﻿
namespace SharpTalk.Core.Services.Contracts.Server
{
    using System.Net.Security;
    using System.ServiceModel;
    using System;

    [ServiceContract(Namespace = "http://SharpTalk/", ProtectionLevel = ProtectionLevel.EncryptAndSign)]
    public interface IRequestServiceBase<
        in TCreateRequest, out TCreateResponse, 
        in TFindRequest, out TFindResponse,
        in TUpdateRequest, out TUpdateResponse,
        in TDeleteRequest, out TDeleteResponse>
    {
        [OperationContract(Name = "Create", Action = "Create", ReplyAction = "CreateResponse", AsyncPattern = true)]
        IAsyncResult BeginCreate(TCreateRequest request, AsyncCallback callback, object state);
        TCreateResponse EndCreate(IAsyncResult result);

        [OperationContract(Name = "Find", Action = "Find", ReplyAction = "FindResponse", AsyncPattern = true)]
        IAsyncResult BeginFind(TFindRequest request, AsyncCallback callback, object state);
        TFindResponse EndFind(IAsyncResult result);

        [OperationContract(Name = "Update", Action = "Update", ReplyAction = "UpdateResponse", AsyncPattern = true)]
        IAsyncResult BeginUpdate(TUpdateRequest request, AsyncCallback callback, object state);
        TUpdateResponse EndUpdate(IAsyncResult result);

        [OperationContract(Name = "Delete", Action = "Delete", ReplyAction = "DeleteResponse", AsyncPattern = true)]
        IAsyncResult BeginDelete(TDeleteRequest request, AsyncCallback callback, object state);
        TDeleteResponse EndDelete(IAsyncResult result);
    }
}